package com.qtt.app.mapper;

import com.qtt.app.entity.AppInstitution;
import com.qtt.app.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
public interface AppInstitutionMapper {
    int deleteByPrimaryKey(Integer institutionId);

    int insert(AppInstitution record);

    int insertSelective(AppInstitution record);

    AppInstitution selectByPrimaryKey(Integer institutionId);

    int updateByPrimaryKeySelective(AppInstitution record);

    int updateByPrimaryKeyWithBLOBs(AppInstitution record);

    int updateByPrimaryKey(AppInstitution record);

//    @Select("SELECT * FROM app_institution")
    List<AppInstitution> getAll();

    AppInstitution getInstitutionById (@Param("institutionId") Integer institutionId);

    @Update("UPDATE app_institution SET institution_name=#{entity.institutionName},introduction=#{entity.introduction},logo_picture=#{entity.logoPicture},teacher_sum=#{entity.teacherSum},course_sum=#{entity.courseSum},institution_grade=#{entity.institutionGrade},sold_course_sum=#{entity.soldCourseSum}  WHERE institution_id = #{id}")
    Boolean updateById(@Param("id") Integer id, AppInstitution entity);


    List<AppInstitution> getRecommendCourse();
}